package tmp;


import java.io.IOException;

import javax.servlet.jsp.JspContext;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;
public class AddTag extends SimpleTagSupport{
  private int a = 0;
  private int b = 0;
  
  public void setA(int v){ this.a = v; }
  public void setB(int v){ this.b = v; }
  
  public void doTag() throws JspException, IOException{
    JspContext jc = getJspContext();
    JspWriter out = jc.getOut();
    
    int sum = a + b;
    jc.setAttribute("sum", Integer.toString(sum));
    
    out.println(this.a + "+" + this.b + "=" + sum);
  }
  
}
